home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / include / expect_comm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-22  |  3.2 KB  |  110 lines

  1. /* expectcomm.h - public symbols common to both expect.h and expect_tcl.h
  2.  
  3. Written by: Don Libes, libes@cme.nist.gov, NIST, 12/3/90
  4.  
  5. Design and implementation of this program was paid for by U.S. tax
  6. dollars.  Therefore it is public domain.  However, the author and NIST
  7. would appreciate credit if this program or parts of it are used.
  8. */
  9.  
  10. #ifndef _EXPECT_COMM_H
  11. #define _EXPECT_COMM_H
  12.  
  13. #include "expect_cf.h"
  14.  
  15. #include <stdio.h>
  16. #include <setjmp.h>
  17. #include "tcl.h"
  18. #include "tclRegexp.h"
  19.  
  20. /* support for Standard C and C++ prototypes */
  21. #ifdef __cplusplus
  22. #  define EXP_PROTOTYPES
  23. #  define EXP_VARARGS    ...
  24. #else
  25. #  define EXP_VARARGS    , ...
  26. #  ifdef __STDC__
  27. #    define EXP_PROTOTYPES
  28. #  endif /*__STDC__*/
  29. #endif /*__cplusplus*/
  30.  
  31. #ifdef EXP_PROTOTYPES
  32. #define EXP_PROTO(x)    x
  33. #ifdef EXP_DEFINE_FNS
  34. /* when functions are really being defined, we have to use va_alist as arg */
  35. #define EXP_PROTOV(x)    va_alist
  36. #else
  37. #define EXP_PROTOV(x)    x
  38. #endif /*EXP_DEFINE_FNS*/
  39. #else
  40. #define EXP_PROTO(x)    ()
  41. #define EXP_PROTOV(x)    ()
  42. #endif /*EXP_PROTOTYPES*/
  43.  
  44. /* Put double parens around macro args so they all look like a single arg */
  45. /* to preprocessor.  That way, don't need a different macro for functions */
  46. /* with a different number of arguments. */
  47.  
  48. EXTERN int errno;
  49.  
  50. #ifdef NO_STDLIB_H
  51. #include "compat/stdlib.h"
  52. #else
  53. #include <stdlib.h>        /* for malloc */
  54. #endif /*NO_STDLIB_H*/
  55.  
  56. /* common return codes for Expect functions */
  57. /* The library actually only uses TIMEOUT and EOF */
  58. #define EXP_ABEOF    -1    /* abnormal eof in Expect */
  59.                 /* when in library, this define is not used. */
  60.                 /* Instead "-1" is used literally in the */
  61.                 /* usual sense to check errors in system */
  62.                 /* calls */
  63. #define EXP_TIMEOUT    -2
  64. #define EXP_TCLERROR    -3
  65. #define EXP_FULLBUFFER    -5
  66. #define EXP_MATCH    -6
  67. #define EXP_NOMATCH    -7
  68. #define EXP_CANTMATCH    EXP_NOMATCH
  69. #define EXP_CANMATCH    -8
  70. #define EXP_DATA_NEW    -9    /* if select says there is new data */
  71. #define EXP_DATA_OLD    -10    /* if we already read data in another cmd */
  72. #define EXP_EOF        -11
  73. #define EXP_RECONFIGURE    -12    /* changes to indirect spawn id lists */
  74.                 /* require us to reconfigure things */
  75.  
  76. /* in the unlikely event that a signal handler forces us to return this */
  77. /* through expect's read() routine, we temporarily convert it to this. */
  78. #define EXP_TCLRET    -20
  79. #define EXP_TCLCNT    -21
  80. #define EXP_TCLCNTTIMER    -22
  81. #define EXP_TCLBRK    -23
  82. #define EXP_TCLCNTEXP    -24
  83. #define EXP_TCLRETTCL    -25
  84.  
  85. /* yet more TCL return codes */
  86. /* Tcl does not safely provide a way to define the values of these, so */
  87. /* use ridiculously numbers for safety */
  88. #define EXP_CONTINUE        -101    /* continue expect command */
  89.                     /* and restart timer */
  90. #define EXP_CONTINUE_TIMER    -102    /* continue expect command */
  91.                     /* and continue timer */
  92. #define EXP_TCL_RETURN        -103    /* converted by interact */
  93.                     /* and interpeter from */
  94.                     /* inter_return into */
  95.                     /* TCL_RETURN*/
  96.  
  97. #define EXP_TIME_INFINITY    -1
  98. #define EXP_SPAWN_ID_BAD    -1
  99.  
  100. EXTERN int exp_is_debugging;
  101. EXTERN int exp_loguser;
  102. EXTERN int exp_disconnected;        /* proc. disc'd from controlling tty */
  103.  
  104. EXTERN void (*exp_close_in_child)();    /* procedure to close files in child */
  105. EXTERN void exp_close_tcl_files();    /* deflt proc: close all Tcl's files */
  106.  
  107. EXTERN void exp_slave_control _ANSI_ARGS_((int,int));
  108.  
  109. #endif /* _EXPECT_COMM_H */
  110.